package com.twu.biblioteca.representation.command;

import com.twu.biblioteca.business.LibService;
import com.twu.biblioteca.representation.BookMenu;

public class BookReserveCommand extends Command {

    private BookMenu bookMenu;

    public BookReserveCommand() {

        bookMenu = new BookMenu();
    }

    public String  execute() {

        System.out.println(bookMenu.showMenu());
        while(true) {
            bookMenu.inputOption();
            if(bookMenu.isOptionValid()) {
                if (libService.reserveBook(bookMenu.getOptionStr())){
                    System.out.println(libService.reserveBook(bookMenu.getOptionStr()));
                    return LibService.BOOK_RESERVED_INFO;
                }
                break;
            }
            else
                continue;
        }
        return LibService.BOOK_RESERVE_FAILED_INFO;
    }

}
